package com.xmy.cultivate.listeners;

import com.xmy.cultivate.entity.*;
import com.xmy.cultivate.service.IStudentFaceManyDetailService;
import com.xmy.cultivate.service.IStudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.xmy.cultivate.constants.MqConstants.*;

@Slf4j
@Component
public class StudentListener {

    @Autowired
    IStudentService iStudentService;

    /**
     *  合并试听学员，传的studentId为，非试听学员id
     * @param
     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_STUDENT_MERGE_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_STUDENT_MERGE_FANOUT, type = ExchangeTypes.FANOUT)
//    ))
//    public void studentMerge(Student student) throws Exception {
//        iStudentService.studentMerge(student);
//    }
//
//    /**
//     * 学员调班，调整缴费率、续报率数据所属老师
//     * @param
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_UPDATE_STUDENT_MERGE_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_UPDATE_STUDENT_MERGE_FANOUT, type = ExchangeTypes.FANOUT)
//    ))
//    public void leaveTeacherStudent(Grade grade) {
//        if (grade == null) {
//            return;
//        }
//        iStudentService.leaveTeacherStudent(grade);
//    }
//
//    /**
//     * 同步离职老师学员
//     * @param
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_UPDATE_STUDENT_MERGE_STATUS_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_UPDATE_STUDENT_MERGE_STATUS_FANOUT, type = ExchangeTypes.FANOUT)
//    ))
//    public void leaveTeacherStudentByStatus(Long teacherId) {
//        if (teacherId == null) {
//            return;
//        }
//        iStudentService.leaveTeacherStudentByStatus(teacherId);
//    }
//
//    /**
//     * 缴费成功，主管变更为老师数据
//     * @param
//     */
//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue(name = QUEUE_ERP_UPDATE_STUDENT_MERGE_PAY_Q1, durable = "true"),
//            exchange = @Exchange(name = EXCHANGE_ERP_UPDATE_STUDENT_MERGE_PAY_FANOUT, type = ExchangeTypes.FANOUT)
//    ))
//    public void leaveTeacherStudentByPay(OrderDetail orderDetail) {
//        if (orderDetail == null) {
//            return;
//        }
//        iStudentService.leaveTeacherStudentByPay(orderDetail);
//    }



}
